<form enctype="multipart/form-data" action="index.php?ctl=admin_reissuedoc&act=apply_add&app=ome&finder_id=<{$finder_id}>" method="post" id="return-apply" target="upload" isCloseDialog>
  <div class="tableform">
    <div class="division">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="girdlist">
        <tr>
          <th>补发店铺：</th>
      <td><select name="shop_id" id="shop_id" vtype="required">
                <{foreach from=$shop_data key=key item=val}>
                <option value="<{$val.shop_id}>" <{if $reissuedoc.shop_id==$val.shop_id}>selected<{/if}> >【<{$val.shop_bn}>】<{$val.name}></option>
                <{/foreach}>
            </select></td>
        </tr>
        <tr>
      <th>原因：</th>
      <td colspan="3"><textarea id="memo" maxth="255" rows="3" cols="80%" name="memo" vtype="required" type="textarea" ><{$reissuedoc.reason}></textarea></td></tr>
        <tr>
          <th colspan="2" align="left">
            <table width="100%" border="0" class="gridlist">
              <thead>
                <tr>
                  <th><{t}>选择<{/t}></th>
                  <th><{t}>基础物料编码<{/t}></th>
                  <th><{t}>基础物料名称<{/t}></th>
                  <th><{t}>规格<{/t}></th>
                  <th><{t}>原价<{/t}></th>
                  <th><{t}>销售价<{/t}></th>
                  <th><{t}>剩余数量<{/t}></th>
                  <th><{t}>申请数量<{/t}></th>
                </tr>
              </thead>
              <{foreach from=$items item=aGoods name="item" key=key}>
              <{if $aGoods.sendnum > '0'}>
              <input type="hidden" name="goods_name[<{$aGoods.bn}>]" value="<{$aGoods.name}>">
              <input type="hidden" name="item_id[<{$aGoods.bn}>]" value="<{$aGoods.item_id}>">
              <input type="hidden" name="product_id[<{$aGoods.bn}>]" value="<{$aGoods.product_id}>">
              <input type='hidden' id='effective<{$aGoods.bn}>' name='effective[<{$aGoods.bn}>]' value='<{$aGoods.effective}>'>
              <tbody>
                <tr id=s<{$aGoods.bn}>>
                  <td><{if $aGoods.effective>0}>
                    <input type="checkbox" <{if $aGoods.disabled eq 'false'}>checked=checked<{/if}>  id="goods_bn" name="goods_bn[]" value='<{$aGoods.bn}>' onclick='choose(this,"<{$aGoods.product_id}>");'><{/if}></td>
                  <td><{$aGoods.bn}></td>
                  <td><{$aGoods.name|visibility:$aGoods.product_id}> </td>
                  <td><{$aGoods.spec_info}></td>
                  <td><{$aGoods.price|cur}></td>
                  <td><{$aGoods.sale_price/$aGoods.nums|cur}></td>
                  <td><{$aGoods.effective}></td>
                  <td>
                    <{if $aGoods.effective>0}>
                      <{if $aGoods.num}>
                      <input type='text' id='num<{$aGoods.bn}>' name='num[<{$aGoods.bn}>]' value='<{$aGoods.num}>' size='6'>
                      <{else}>
                      <input type='text' id='num<{$aGoods.bn}>' name='num[<{$aGoods.bn}>]' value='<{$aGoods.effective}>' size='6'>
                      <{/if}>
                    <{/if}>
                  </td>
                </tr>
              </tbody>
              <{/if}>
              <{/foreach}>
          </table></th>
        </tr>        
      </table>
    </div>
    
    <div class="table-action">
      <{button label="保存" class="btn-primary" type='submit'}> <span class="red">注：仔细确认店铺是否正确！</span>
    </div>
    <input type="hidden" name="url" value="index.php?app=ome&ctl=admin_return&act=index" />
    <input type="hidden" name="order_id" value="<{$order_id}>" />
    <input type="hidden" name="id" value="<{$reissuedoc.id}>" />
    <input type="hidden" name="source" value="<{$source}>">
  </div>
</form>
<script>


  /*
  *选择商品时选择对应仓库信息
  *默认取的是第一条
  */
  function choose(bn,product_id){

    var s = 'branch_id'+product_id,el;
    el = $ES('input[name$='+s+']');
    el.each(function(item,index){
      if(bn.checked==true){
        if(index==0){
          if (el.length==1){
            item.checked=true;
          }
        }
        if (el.length>1)
        item.set('vtype', 'requiredradio');
        }else{
        item.set('vtype', '');
        item.checked=false;
        $('dly-body').empty();
      }

    });
  }

  function visibility(e){
    var visiTips = new Tips({
            onShow:function(tip,el){
                el.addClass('active');
                tip.setStyle('display','block');
            },
            text: function(element){
                if(element.get('visibility')=='false'){
                    return '不可售商品';
                }else{
                    return '';
                }
            }
        });

        var e  = new Event(e), el = e.target;
        if (el.get('visibility')=='false')
        {
            visiTips.attach(el);
            el.addEvent('mouseleave',function(){
                el.removeClass('active');
            });
            el.fireEvent('mouseenter',e);
        }
}
</script>
